import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' // 引入 ElementPlus 样式
import { ElLoading } from 'element-plus'
import axios from "axios";
// 导入所有图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'


// 创建 Vue 应用实例
const app = createApp(App)

// 注册 ElementPlus 组件库
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(ElLoading);

// 注册 Vuex store 和 Vue Router
app.use(store)
app.use(router)

axios.defaults.baseURL="http://localhost:8080"
app.config.globalProperties.$http = axios

// 注册所有 ElementPlus 图标为全局组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 挂载应用
app.mount('#app')